#include<bits/stdc++.h>
using namespace std;


void solve(){
	int n;
	cin>>n;
	int ans=2*n-1; 
	cout<<ans<<endl;
	int i=1;
	int m=ans-1;
	while(m--){
		cout<<i<<" "<<1<<" "<<i<<endl;
		cout<<i<<" "<<i+1<<" "<<n<<endl;
		i++;
	}
	cout<<n<<" "<<1<<" "<<n<<endl;
}

int main(){
	int t;
	cin>>t;
	while(t--){
		solve(); 
	}
	return 0;
} 
